package org.example.controller;

import org.example.pojo.CommonResult;
import org.example.pojo.Payment;
import org.example.service.PaymentFeignService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

@RestController
//@SuppressWarnings(value = )
public class CustomerFeignController {
    @Autowired(required = false)
    PaymentFeignService paymentFeignService;

    @GetMapping("consumer/feign/payment/{id}")
    public CommonResult<Payment> findPaymentById(@PathVariable("id") Long id){
        return paymentFeignService.findPaymentById(id);
    }

    //超时控制
    @GetMapping("consumer/feign/timeout")
    public String timeout(){
        //openfeign调用服务，默认等待时间是1秒钟
        return paymentFeignService.paymentFeignTimeOut();
    }


    //localhost/consumer/feign/payment/1
    //localhost/consumer/feign/timeout

    //http://localhost/consumer/feign/payment/1
}
